package com.example.bean.query;

import com.example.common.InvokeResult;
import lombok.Data;
import lombok.EqualsAndHashCode;


@EqualsAndHashCode(callSuper = true)
@Data
public class PageResult<T> extends InvokeResult<T> {
    private Long total;

    private Integer totalPages;

    private Integer curPage;

    private Integer pageSize;

    public PageResult(T data, Long total, Integer totalPages, Integer curPage, Integer pageSize) {
        super(data);
        this.total = total;
        this.totalPages = totalPages;
        this.curPage = curPage;
        this.pageSize = pageSize;
    }

    public PageResult() {
        super();
    }

    public static <T> PageResult<T> success(T data, Long total, Integer totalPages, Integer curPage, Integer pageSize) {
        return new PageResult<>(data, total, totalPages, curPage, pageSize);
    }
}
